package edu.kjxy.day03.t8;

/**
 * 功能:
 * 作者:程序员欧阳子韩
 * 日期:2024/2/2 18:42
 */
public class Task {
     synchronized public void otherMethod() {
        System.out.println("-------------------run-otherMethod");
    }

    public void doLongTimeTask() {
        synchronized (this) {
            for (int i = 0; i < 10000; i++) {
                System.out.println("synchronized threadName=" +
                        Thread.currentThread().getName() + "i=" + (i + 1));
            }
        }
    }
}
